/*
*  Copyright (c) 2006-2020, Chukie
*  
*  SPDX-License-Identifier: Apache-2.0
*  
*  @file     : cellular_comm.h
*  
*  @brief    : 
*  Website   : https://gitee.com/open-embedded
*  
*  
*  Change Logs:
*  Date           Author          Notes
*  2020-06-23     zhaocj       The first version
*/
/* Define to prevent recursive inclusion ------------------------------------*/
#ifndef __CELLULAR_COMM_H__
#define __CELLULAR_COMM_H__
/* Includes -----------------------------------------------------------------*/
#include "cellular_def.h"
#ifdef __cplusplus
extern "C"
{
#endif /*__cplusplus*/
/* Exported types -----------------------------------------------------------*/
/* Exported constants -------------------------------------------------------*/
/* Exported macro -----------------------------------------------------------*/
/* Exported functions -------------------------------------------------------*/
void cellular_comm_init(cellular_device_t dev);
void cellular_comm_set_module_state(cellular_device_t dev, module_state_t state);
void cellular_comm_select_sim(cellular_device_t dev,uint8_t sim_idx);

int cellular_comm_exe_at_list(at_client_t atc, const struct at_cmd *at_list, size_t list_size, cellular_device_t dev, uint32_t timeout);
int cellular_comm_exe_creg_list(at_client_t atc, const struct at_cmd *at_list, size_t list_size, cellular_device_t dev, uint32_t timeout);
/**
 * @brief check sim whether ready
 *
 * @param c
 * @param resp
 * @param usr_ctx
 * @return int
 *          0: failed
 *          !0: success
 */
int cellular_comm_check_sim(at_client_t c, const char *resp, void *usr_ctx);

/**
 * @brief query csq
 *
 * @param c  pointer to AT client
 * @param resp  respone buf
 * @param usr_ctx
 * @return int
 *          0: failed
 *          !0: success
 */
int cellular_comm_query_csq(at_client_t c, const char *resp, void *usr_ctx);

/**
 * @brief query register state
 *
 * @param c pointer to AT client
 * @param resp
 * @param usr_ctx
 * @return int
 *          0: failed
 *          !0: success
 */
int cellular_comm_query_register(at_client_t c, const char *resp, void *usr_ctx);

/**
 * @brief query attach state
 *
 * @param c pointer to AT client
 * @param resp
 * @param usr_ctx
 * @return int
 *          0: failed
 *          !0: success
 */
int cellular_comm_query_attach(at_client_t c, const char *resp, void *usr_ctx);

/**
 * @brief query operator
 *
 * @param c pointer to AT client
 * @param resp
 * @param usr_ctx
 * @return int
 *          0: failed
 *          !0: success
 */
int cellular_comm_query_operator(at_client_t c, const char *resp, void *usr_ctx);

/**
 * @brief connect data
 *
 * @param c pointer to AT client
 * @param resp
 * @param usr_ctx
 * @return int
 *          0: failed
 *          !0: success
 */
int cellular_comm_data_connect(at_client_t c, const char *resp, void *usr_ctx);

/**
 * @brief disconnect data
 *
 * @param c pointer to AT client
 * @param resp
 * @param usr_ctx
 * @return int
 *          0: failed
 *          !0: success
 */
int cellular_comm_data_disconnect(at_client_t c, const char *resp, void *usr_ctx);

#ifdef __cplusplus
{
#endif /*__cplusplus*/
#endif /*__CELLULAR_COMM_H__*/
/* End of file****************************************************************/

